<template>
<onekit-page>
<onekit-view onekit-class="container">
	<div is="onekit-template-head" :DATA="`${JSON.stringify({title:'get/set/ClipboardData'})}`"></div>
	<onekit-view onekit-class="page-body">
		<onekit-view onekit-class="weui-cells weui-cells_after-title">
			<onekit-view onekit-class="weui-cell weui-cell_input">
				<onekit-view onekit-class="weui-cell__hd">
					<onekit-view onekit-class="weui-label">Copy</onekit-view>
				</onekit-view>
				<onekit-view onekit-class="weui-cell__bd">
					<onekit-input onekit-class="weui-input" type="text" name="key" :value="value" @Input="valueChanged"></onekit-input>
				</onekit-view>
			</onekit-view>
			<onekit-view onekit-class="weui-cell weui-cell_input">
				<onekit-view onekit-class="weui-cell__hd">
					<onekit-view onekit-class="weui-label">Paste</onekit-view>
				</onekit-view>
				<onekit-view onekit-class="weui-cell__bd">
					<onekit-input onekit-class="weui-input" type="text" :value="pasted"></onekit-input>
				</onekit-view>
			</onekit-view>
		</onekit-view>
		<onekit-view onekit-class="btn-area">
			<onekit-button type="primary" @Tap="copy">复制</onekit-button>
			<onekit-button @Tap="paste">粘贴</onekit-button>
		</onekit-view>
	</onekit-view>
	<div is="onekit-template-foot"></div>
</onekit-view>
</onekit-page></template>
<script>
/* eslint-disable */
import Vue from 'vue';
import onekit_template_0 from '../../../common/head.head.vue';Vue.component('onekit-template-head',onekit_template_0);
import onekit_template_1 from '../../../common/foot.foot.vue';Vue.component('onekit-template-foot',onekit_template_1);
const ONEKIT_JSON= {
  "navigationBarTitleText": "剪切板",
  "usingComponents": {
    
  }
};
const ONEKIT_SJS = {
};
import wx from '../../../../weixin2vue/wx.js';
import Macro from '../../../../weixin2vue/Macro.js';
const {getApp,getCurrentPages} = Macro;
import Page from '../../../../weixin2vue/OnekitPage.js';
import Component from '../../../../weixin2vue/OnekitComponent.js';
export default Page(ONEKIT_JSON,["value","pasted"],ONEKIT_SJS,{
    "onShareAppMessage"(){
      return {
        "title":'剪切板',
        "path":'packageAPI/pages/clipboard-data/clipboard-data'
};
    },
    "data":{
        "value":'edit and copy me',
        "pasted":''
},
    "valueChanged"(e){
      this.setData({
        "value":e.detail.value
});
    },
    "copy"(){
      wx.setClipboardData({
        "data":this.data.value,
        "success"(){
          wx.showToast({
            "title":'复制成功',
            "icon":'success',
            "duration":1000
});
        }
});
    },
    "paste"(){
      const self = this;
      wx.getClipboardData({
        "success"(res){
          self.setData({
            "pasted":res.data
});
          wx.showToast({
            "title":'粘贴成功',
            "icon":'success',
            "duration":1000
});
        }
});
    }
});

</script>
<style 
 lang="css">
@import '/common/lib/weui.css';
.page-body-info {
  padding: 5px ;
  height: 100px ;
  overflow: scroll-y ;
  text-align: left ;
}
</style>